
let app = getApp();
import { scoreMcList } from "../../api/score"
Page({
	data: {
		safetyArea: app.globalData.safetyArea + 16,
		statusHeight: app.globalData.window.statusHeight || 1,
		navheight: app.globalData.window.navheight || 1,
		id: null,
		pageNumber: 1,
		isLoading: false,
		isFinish: false,
		scoreProjectList: [],
		statusData: ['待打分', '待提交', '已提交', '已完成']
	},
	onLoad() {
		// this.getList()
	},
	onShow() {
		this.setData({
			scoreProjectList: [],
			isLoading: false,
			isFinish: false,
		})
		this.getList()
	},
	onReachBottom(){ //分页
		if(this.data.isLoading || this.data.isFinish) return
		this.setData({
			pageNumber: this.data.pageNumber + 1
		})
		this.getList()
	},
	getList() {
		let data = {
			pageSize: 10,
			pageNumber: this.data.pageNumber
		}
		this.setData({ isLoading: true })
		scoreMcList(data).then(res => {
			this.setData({
				scoreProjectList: [...this.data.scoreProjectList, ...res.data.result.data],
				isLoading: false,
				isFinish: res.data.result.data.length < 10
			})
		})
	},
	goPath(e) {
		const { item } = e.currentTarget.dataset;
		wx.navigateTo({ url: `/pages/promoted/index?id=${item.scoreProjectId}` })
	}
})
